
(defun gcd (a b)
  "求 a b的最大公约数"
  (if (< a b)
      (gcd b a)
      (if (zerop b)
	  a
	(gcd b (% a b)))))



(defun square (n)
  (* n n))

(defun can-divide? (a b)
  "a % b 是否为0"
  (zerop (% a b)))

(defun prime? (n)
  "检查n是否为素数"
  (defun iter (k)
    (if (> (square k) n)
	t
      (if (can-divide? n k)
	  nil
	(iter (1+ k)))
    ))
  (iter 2)
  )

;;(prime? 4)


(let ((n 2))
  (while (< n 100)
    (message "n:%d 是否为素数:%S" n (prime? n))
    (setq n (1+ n)))
  )
